package json;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import utils.json.JsonUtils;

import junit.framework.TestCase;

public class JsonUtilsTest extends TestCase{

	public void testConvertMap(){
		Map<String,Object> map = new HashMap<String, Object>();
		map.put("a", 1);
		map.put("b", "'2'");
		map.put("c", true);
		map.put("d", new Date());
		
		String str = JsonUtils.convert(map);
		System.out.println(str);
	}
	
	public void testConvertArray(){
		List<Integer> list = new ArrayList<Integer>();
		list.add(1);
		list.add(2);
		list.add(3);
		String str = JsonUtils.convert(list);
		System.out.println(str);
	}
	
	public void testConvertBean(){
		Map<String,BeanTester> beanTesterMap = new HashMap<String, BeanTester>();
		beanTesterMap.put("bt", new BeanTester());
		List<BeanTester> beanTesterList = new ArrayList<BeanTester>();
		beanTesterList.add(new BeanTester());
		BeanTester beanTester = new BeanTester();
		beanTester.setBeanTesterMap(beanTesterMap);
		beanTester.setBeanTesterList(beanTesterList);
		String str = JsonUtils.convert(beanTester);
		System.out.println(str);
	}
}
